﻿// HSS.Data.IDataEntityAdd.cs
// ----------------------------------------------------------------------------
// Licensed under the MIT license
// http://www.opensource.org/licenses/mit-license.html
// ----------------------------------------------------------------------------
// HighSpeed-Solutions, LLC
// Copyright (c) 2001-2010
// ----------------------------------------------------------------------------
// File:       IDataEntityAdd.cs
// Author:     HSS\gbanta
// Created:    08/12/2010
// Modified:   12/04/2010
// ----------------------------------------------------------------------------
namespace HSS.Data
{
	#region Using Directives
	using System.Data.SqlClient;

	#endregion

	#region IDataEntityAdd
	/// <summary>
	/// IDataEntityAdd marks a class as supporting the AddNew feature of <see cref="DataAccessService{TDataEntity}"/> services.
	/// </summary>
	public interface IDataEntityAdd<TID>
	{
		/// <summary>
		/// Add this item to the database.
		/// </summary>
		/// <param name="da">The current DataAccess instance</param>
		/// <param name="state">Optional state containing any additional data.</param>
		/// <param name="result">An ref parameter that will contain the return value from the database call.</param>
		/// <returns>The id of the newly added item</returns>
		TID AddNew(DataAccess da, object[] state, ref int result);
	}
	#endregion

	#region IDataEntityAddTrx
	/// <summary>
	/// IDataEntityAddTrx marks a class as supporting the AddNew feature of <see cref="DataAccessService{TDataEntity}"/> services.
	/// </summary>
	public interface IDataEntityAddTrx<TID>
	{
		/// <summary>
		/// Add this item to the database.
		/// </summary>
		/// <param name="cmd">The current SqlCommand instance</param>
		/// <param name="state">Optional state containing any additional data.</param>
		/// <param name="result">An ref parameter that will contain the return value from the database call.</param>
		/// <returns>The id of the newly added item</returns>
		TID AddNew(SqlCommand cmd, object[] state, ref int result);
	}
	#endregion

	#region IDataEntityBatchAdd
	/// <summary>
	/// IDataEntityBatchAdd marks a class as supporting the AddBatch feature of <see cref="DataAccessService{TDataEntity}"/> services.
	/// </summary>
	public interface IDataEntityBatchAdd
	{
		/// <summary>
		/// Add this batch item to the database.
		/// </summary>
		/// <param name="da">The current DataAccess instance.</param>
		/// <returns>true if the item was successfully added; otherwise false.</returns>
		bool AddNewBatchItem(DataAccess da);
	}
	#endregion

	#region IDataEntityBatchAddTrx
	/// <summary>
	/// IDataEntityBatchAddTrx marks a class as supporting the AddBatch feature of <see cref="DataAccessService{TDataEntity}"/> services.
	/// </summary>
	public interface IDataEntityBatchAddTrx
	{
		/// <summary>
		/// Add this batch item to the database.
		/// </summary>
		/// <param name="cmd">The current SqlCommand instance.</param>
		/// <returns>true if the item was successfully added; otherwise false.</returns>
		bool AddNewBatchItem(SqlCommand cmd);
	}
	#endregion
}